#!/bin/bash
OK=0
WARN=1
CRITICAL=2
UNKNOWN=3
PATH="/bin:/sbin:/usr/bin:/usr/sbin"

Ok_name=''
Fail_name=''
Judge=0
TTimeout=2

function check_booted() {
		#continue
		value=`/bin/eos fs ls | grep '^ ' | grep -v '^$' |  awk -F' ' '{ if ($6!="booted"){printf $1"-"$4"-error\t" } }'`
		#echo $value
                if [ "A$value" == "A"  ]
                then
			Ok_name="eos disk all booted"
		else
                        Judge=1
                        Fail_name="$value"
                fi
		#echo $choice end
}


check_booted

if [ $Judge -eq 1 ]
then
	echo "$Fail_name  wrong"
	/home/huqb/perljiaoben/Python/Python-2.6/bin/python /home/huqb/perljiaoben/sendsms/smtp.pyc -s eos_disk_boot_error -t "$Fail_name" huqb@ihep.ac.cn
	perl /home/huqb/perljiaoben/sendsms/SmsWarningClient.pl sms.ihep.ac.cn 123 "eos disk boot error " sms 15510641006 >> /home/huqb/perljiaoben/sendsms/sendsms.log
	perl /home/huqb/perljiaoben/sendsms/SmsWarningClient.pl sms.ihep.ac.cn 123 "eos disk boot error " sms 13811338941 >> /home/huqb/perljiaoben/sendsms/sendsms.log
	perl /home/huqb/perljiaoben/sendsms/SmsWarningClient.pl sms.ihep.ac.cn 123 "eos disk boot error " sms 18910760822 >> /home/huqb/perljiaoben/sendsms/sendsms.log
	exit $CRITICAL
else
	echo " $Ok_name are OK "
	exit $OK
fi

